package cc.owoo.godpen.network.http;

/**
 * Created by nimensei
 * 2022-02-25 下午 09:37
 **/
public class UserAgent extends HeaderProperty<UserAgent> {
    // 微软的Edge浏览器
    public static final String EDGE = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 Edg/98.0.1108.56";
    // 谷歌的Chrome浏览器
    public static final String CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36";
    // Android11浏览器
    public static final String XBROWSER = "Mozilla/5.0 (Linux; Android 11; PCRM00 Build/RKQ1.200903.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36";

    String userAgent;

    public UserAgent() {
        super("user-agent");
    }

    /**
     * 拷贝对象
     *
     * @param userAgent 拷贝源
     */
    public void copySet(UserAgent userAgent) {
        this.userAgent = userAgent.userAgent;
    }

    @Override
    public boolean isEmpty() {
        return userAgent == null;
    }

    @Override
    public String stringify() {
        return userAgent;
    }

    @Override
    public UserAgent parse(String value) {
        userAgent = value;
        return this;
    }

    @Override
    public void clear() {
        userAgent = null;
    }
}
